onrowcheck Event |
This event is executed when a row is checked or unchecked.
Syntax
Inline HTML |
<div cordysType="wcp.library.ui.XGrid" id="xgridId" onrowcheck="handler()"> ... </div> |
Event property | xgridId.onrowcheck = handler |
Event Information
To invoke | Select the check row check box of the row or select the 'check all rows' checkbox in the header. ThecheckAllRows()(for every row) method fires this event. |
Default Action | Initiates any action associated with this event. |
Event Object Properties
Although event handlers in the DHTML Object Model do not receive parameters directly, a handler can query an event object for data.
Property | Description |
---|---|
businessObject | XML node of the business object associated with the row. |
checked | Boolean. Indicates whether the row checked or unchecked. |
data | XML node that is the basis for the content in the XGrid. |
getIndex() | Returns the row index, where the first row has index=1 |
getCells() | Returns an array of cell objects. |
returnValue | Boolean. When set to false, cancels the (un)check of the row. |
row | Refers to the HTML node of the row that was checked. |
rowData | XML node of the rowData. |
rowFreezeColumn | Refers to the HTML node of the frozen part (if any) of a row. |
srcElement | Refers to the HTML node of the cell that was checked and caused the event to be executed. |
Example
The following example demonstrates how you can exclude certain rows when you check all rows in a grid.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html onapplicationready="getData()"> <head> <title>onrowcheck method</title> <script src="/cordys/wcp/application.js"></script> <script> function getData() { bdiEmployees.reset(); employeesGrid.bindData( bdiEmployees.data ); } function handleOnrowCheck() { var evnt = window.application.event; var index = evnt.getIndex(); if ( index % 2==0 ) { evnt.returnValue = false; application.notify("Only rows with an odd index can be checked"); } } </script> <script type="cordys/xml" id="details"> <SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP:Body> <GetEmployeesObjects xmlns="http://schemas.cordys.com/DemoWebServices"> <fromEmployeeID>1</fromEmployeeID> <toEmployeeID>10</toEmployeeID> </GetEmployeesObjects> </SOAP:Body> </SOAP:Envelope> </script> </head> <body> <div cordysType="wcp.library.data.BusDataIsland" async="false" id="bdiEmployees" request="details.XMLDocument"> </div> <body scroll="no" leftmargin="0" topmargin="0"> <div style="width:100%;height:100%;overflow:hidden"> <div cordysType="wcp.library.ui.XGrid" id="employeesGrid" onrowcheck="handleOnrowCheck()" xpathRowData = ".//*[local-name()='data']/*[local-name()='GetEmployeesObjectsResponse']/*[local-name()='tuple']"; xpathBusinessObject = ".//*[local-name()='Employees']" style="width:600;height:150"> <div id="EmployeeID" ref=".//*[local-name()='EmployeeID']" dataType="integer">EmployeeID</div> <div id="FirstName" ref=".//*[local-name()='FirstName']">FirstName</div> <div id="LastName" ref=".//*[local-name()='LastName']">LastName</div> </div> </div> <!--div cordysType="wcp.library.ui.XGrid" id="employeesGrid" onrowcheck="handleOnrowCheck()" xpathRowData = "data/nwd:GetEmployeesResponse/nwd:tuple" xpathBusinessObject = ".[nwd:new]/nwd:new/nwd:Employees | .[not(nwd:new)]/nwd:old/nwd:Employees" style="width:600;height:150"> <div id="EmployeeID" ref="nwd:EmployeeID" dataType="integer">EmployeeID</div> <div id="FirstName" ref="nwd:FirstName">FirstName</div> <div id="LastName" ref="nwd:LastName">LastName</div> </div--> </body> </html>